<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>公告列表 - Powered By Betou</title>
<meta name="author" content="Betou Team" />
<meta name="copyright" content="Betou" />
<#include "../head_list.html"/>
<script type="text/javascript">
$().ready(function() {
	<#if pagination.totalCount==0>
		$.message("warn", "暂无数据！");
	</#if>

	var $listForm = $("#listForm");
	var $filterSelect = $("#filterSelect");
	var $filterOption = $("#filterOption a");
	
	$filterSelect.mouseover(function() {
		var $this = $(this);
		var offset = $this.offset();
		var $menuWrap = $this.closest("div.menuWrap");
		var $popupMenu = $menuWrap.children("div.popupMenu");
		$popupMenu.css({left: offset.left, top: offset.top + $this.height() + 2}).show();
		$menuWrap.mouseleave(function() {
			$popupMenu.hide();
		});
	});
	
	$filterOption.click(function() {
		var $this = $(this);
		var $dest = $("#" + $this.attr("name"));
		if ($this.hasClass("checked")) {
			$dest.val("");
		} else {
			$dest.val($this.attr("val"));
		}
		$listForm.submit();
		return false;
	});
	var filterStatus = '${filterStatus!}';
	$.each($filterOption,function(i,e){
		var $this = $(this);
		if( $this.attr("val") == filterStatus ){
			$this.addClass('checked');
		}
	})
});

send = function( id ){
	$.dialog({
		type: "warn",
		content: "您确定发送短信吗？",
		ok: "确定",
		cancel: "取消",
		onOk: function() {
			$.ajax({
				url: "o_send.jspx" ,
				type: "POST",
				data: {"id": id},
				cache: false,
				success: function(message) {
					if( typeof(message) == 'string' ){
						var msg;
						if( message.indexOf("integrityViolation") != -1 ){
							msg = "数据被引用，不能删除！";
						}else{
							msg = "系统繁忙，请稍后重试！"
						}
						message = {type:"error", content: msg };
					}
					$.message(message);
					if (message.type == "success") {
						
					}
				},
				error:function(xmlHttpRequest, message, e){
					$.message( "error", e );
				}
			});
		}
	});
	
}

</script>
</head>
<body class="content">
	<div class="path">
		<a href="../index.jspx">首页</a> &raquo; 公告列表 <span>(共<span id="pageTotal">${pagination.totalCount!0}</span>条记录)</span>
	</div>
	<form id="listForm"  class="clearfix" action="v_list.jspx" method="post">
		<div class="bar">
			<a href="v_add.jspx" class="iconButton"><span class="addIcon">&nbsp;</span>添加</a>
			<div class="buttonWrap">
				<a href="javascript:;" id="deleteButton" class="iconButton disabled"><span class="deleteIcon">&nbsp;</span>删除</a>
				<a href="javascript:;" id="refreshButton" class="iconButton"><span class="refreshIcon">&nbsp;</span>刷新</a>
				<#if typeList??>
				<div class="menuWrap">
					<a class="button" id="filterSelect" href="javascript:;">类别<span class="arrow">&nbsp;</span></a>
					<div class="popupMenu" style="left: 139px; top: 59px; display: none;">
						<ul class="check" id="filterOption">
							<#list typeList as c>
								<li><a val="noticeType.id,${c.id!},integer"  name="filterStatus" href="javascript:;">${c.name!}</a></li>
							</#list>	
						</ul>
					</div>
				</div>
				</#if>
				<div class="menuWrap">
					<a class="button" id="filterSelect" href="javascript:;">选择数据<span class="arrow">&nbsp;</span></a>
					<div class="popupMenu" style="left: 139px; top: 59px; display: none;">
						<ul class="check" >
							<li><a href="../share/v_list.jspx?view=notice"  target="_blank">看看机构的数据</a></li>
						</ul>
					</div>
				</div>
				<#include "../pageselect.html"/>
			</div>
			<div class="menuWrap">
				<div class="search">
					<span id="searchPropertySelect" class="arrow">&nbsp;</span>
					<input type="text"  id="searchValue" name="searchValue" value="${searchValue!}" maxlength="200" />
					<button type="submit">&nbsp;</button>
				</div>
				<div class="popupMenu">
					<ul id="searchPropertyOption">
						<li><a href="javascript:;" val="title">标题</a></li>
						<#if admin.system>
							<li><a href="javascript:;" val="admin.username">发布者</a></li>
						</#if>
					</ul>
				</div>
			</div>
		</div>
		<table id="listTable" class="list">
			<tr>
				<th class="check"><input type="checkbox" id="selectAll" /></th>
				<th><a href="javascript:;" class="sort" name="title">标题</a></th>
				<th><a href="javascript:;" class="sort" name="addDate">发布日期</a></th>
				<th><a href="javascript:;" class="sort" name="admin.id">发布者</a></th>
				<th><a href="javascript:;" class="sort" name="noticeType.id">类别</a></th>
				<th><span>操作</span></th>
			</tr>
			<#list pagination.list as c>
				<tr>
					<td><input type="checkbox" name="ids"  title=""  value="${c.id!}" /></td>
					<td>
						<#if c.admin.id == admin.id>
						<span class="blue" title="我发布的公告">${c.title!}</span>
						<#else>
						${c.title!}
						</#if>
					</td>	
					<td>
						<span title="${c.addDate?string('yyyy-MM-dd hh:mm:ss')}">${c.addDate?string('yyyy-MM-dd')}</span>
					</td>
					<td><span class="green">${c.admin.username!}</span></td>
					<td>
						<#if c.noticeType.identity == 's'>
							<span class="red">${c.noticeType.name!}</span>
						<#else>
							<span class="blue">${c.noticeType.name!}</span>
						</#if>
					</td>
					<td>
						<a href="v_edit.jspx?id=${c.id!}">[编辑]</a>
<!--						<#if c.noticeType.identity != 's'>-->
<!--						&nbsp;&nbsp;<a href="javascript:;" onclick="send(${c.id!})">[发送短信]</a>-->
<!--						</#if>-->
					</td>
				</tr>
			</#list>
		</table>
		<#include "../list_hidden.html" />
		<#include "../page.html" />
	</form>
	<#include "../footer.html"/>
</body>
</html>